home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / hack / 3_1_3 / sys / amiga / winkey.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-05  |  1.9 KB  |  106 lines

  1. /*    SCCS Id: @(#)winkey.c    3.1    93/04/02 */
  2. /* Copyright (c) Gregg Wonderly, Naperville, Illinois,  1991,1992,1993. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include "amiga:windefs.h"
  6. #include "amiga:winext.h"
  7. #include "amiga:winproto.h"
  8.  
  9. amii_nh_poskey(x, y, mod)
  10.     int*x, *y, *mod;
  11. {
  12.     struct amii_WinDesc *cw;
  13.     WETYPE type;
  14.     struct RastPort *rp;
  15.     struct Window *w;
  16.  
  17.     if( cw = amii_wins[WIN_MESSAGE] )
  18.     {
  19.     cw->wflags &= ~FLMAP_SKIP;
  20.     if( scrollmsg )
  21.         cw->wflags |= FLMSG_FIRST;
  22.     cw->disprows = 0;
  23.     }
  24.  
  25.     if( WIN_MAP != WIN_ERR && (cw = amii_wins[ WIN_MAP ]) && ( w = cw->win ) )
  26.     {
  27.     cursor_on( WIN_MAP );
  28. #ifdef    VIEWWINDOW
  29.     cursor_on( WIN_VIEW );
  30. #endif
  31.     }
  32.     else
  33.     panic( "no MAP window opened for nh_poskey\n" );
  34.  
  35.     rp = w->RPort;
  36.  
  37.     while( 1 )
  38.     {
  39.     type = WindowGetevent( );
  40.     if( type == WEMOUSE )
  41.     {
  42.         *mod = CLICK_1;
  43.         if( lastevent.un.mouse.qual )
  44.         *mod = 0;
  45.  
  46.         /* X coordinates are 1 based, Y are zero based. */
  47.         *x = ( (lastevent.un.mouse.x - w->BorderLeft) / MAPFTWIDTH ) + 1;
  48.         *y = ( ( lastevent.un.mouse.y - w->BorderTop - MAPFTBASELN ) /
  49.             MAPFTHEIGHT );
  50.         return( 0 );
  51.     }
  52.     else if( type == WEKEY )
  53.     {
  54.         lastevent.type = WEUNK;
  55.         return( lastevent.un.key );
  56.     }
  57.     }
  58. }
  59.  
  60. int
  61. amii_nhgetch()
  62. {
  63.     int ch;
  64.     struct amii_WinDesc *cw=amii_wins[WIN_MESSAGE];
  65.  
  66.     if( WIN_MAP != WIN_ERR && amii_wins[ WIN_MAP ] )
  67.     {
  68.     cursor_on( WIN_MAP );
  69. #ifdef    VIEWWINDOW
  70.     cursor_on( WIN_VIEW );
  71. #endif
  72.     }
  73.     if(cw)
  74.         cw->wflags &= ~FLMAP_SKIP;
  75.  
  76.     ch = WindowGetchar();
  77.     return( ch );
  78. }
  79.  
  80. void
  81. amii_get_nh_event()
  82. {
  83.     /* nothing now - later I have no idea.  Is this just a Mac hook? */
  84. }
  85.  
  86. void
  87. amii_getret()
  88. {
  89.     register int c;
  90.  
  91.     raw_print( "" );
  92.     raw_print( "Press Return..." );
  93.  
  94.     c = 0;
  95.  
  96.     while( c != '\n' && c != '\r' )
  97.     {
  98.     if( HackPort )
  99.         c = WindowGetchar();
  100.     else
  101.         c = getchar();
  102.     }
  103.     return;
  104. }
  105.  
  106.